﻿<%@ Page Title="AGR: Language Admin" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Language.aspx.cs" Inherits="AGR.Web.Pages.Administration.Language" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="RightContent" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">

    <h3>Language Administration</h3>
    <hr />

    <asp:UpdatePanel ID="LanguageUpdatePanel" runat="server">
    <ContentTemplate>

    <table>
        <tr>
            <td>
                <asp:Button ID="btnAdd" runat="server" Text="Add" CssClass="button" onclick="btnAdd_Click" />
                <asp:Button ID="btnDelete" runat="server" Text="Remove" CssClass="button" onclick="btnDelete_Click" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="LanguageGridView" runat="server" CssClass="table-grid" AlternatingRowStyle-CssClass="odd" FooterStyle-CssClass="table-grid-footer"
                EmptyDataRowStyle-CssClass="empty" EmptyDataText="No countries found." PagerStyle-CssClass="pager"
                DataKeyNames="LanguageName"
                AutoGenerateColumns="False" onrowcommand="LanguageGridView_OnRowCommand"
                onrowcancelingedit="LanguageGridView_RowCancelingEdit" onrowediting="LanguageGridView_RowEditing" onrowupdating="LanguageGridView_RowUpdating" 
                onpageindexchanging="LanguageGridView_PageIndexChanging"
                AllowPaging="True" PageSize="10">
                    <PagerSettings Mode="NumericFirstLast" Position="Bottom"/>
                    <Columns>
                        <asp:TemplateField HeaderText="Select" HeaderStyle-Width="40px" 
                         HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" CausesValidation="False"> </asp:CheckBox>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" Enabled="false" CausesValidation="False"> </asp:CheckBox>
                            </EditItemTemplate>
                            <FooterTemplate>
                                    <strong>Add</strong>
                                </FooterTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Options" HeaderStyle-Width="90px" HeaderStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkLanguageEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:LinkButton ID="lnkLanguageCancel" runat="server" CausesValidation="False"  CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                                &nbsp;
                                <asp:LinkButton ID="lnkLanguageUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update"
                                    ValidationGroup="LanguageUpdateValidationGroup"></asp:LinkButton>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:LinkButton ID="btnLanguageCancel" runat="server" Text="Cancel" CausesValidation="false" UseSubmitBehavior="false" CommandName="CancelInsert" />
                                &nbsp;
                                <asp:LinkButton ID="btnLanguageInsert" runat="server" Text="Save" UseSubmitBehavior="false" CommandName="Insert"
                                    ValidationGroup="LanguageSaveValidationGroup" />
                            </FooterTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Language" HeaderStyle-Width="110px">
                            <ItemTemplate><%# Eval("LanguageName")%></ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtLanguageName" runat="server" Text='<%# Eval("LanguageName")%>' Width="100px" Enabled="false"></asp:TextBox>
                                <asp:RequiredFieldValidator ControlToValidate="txtLanguageName" ID="LanguageNameValidator" runat="server" ErrorMessage=" * " 
                                    Display="Dynamic" CssClass="ClassValidator" ValidationGroup="LanguageUpdateValidationGroup" ></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="txtLanguageName" runat="server" Width="100px"></asp:TextBox>
                                <asp:RequiredFieldValidator ControlToValidate="txtLanguageName" ID="LanguageNameValidator" runat="server" ErrorMessage=" * " 
                                    Display="Dynamic" CssClass="ClassValidator"  ValidationGroup="LanguageSaveValidationGroup" ></asp:RequiredFieldValidator>
                            </FooterTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Displayed" HeaderStyle-Width="50px" FooterStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkDisplayed" runat="server" Enabled="false" 
                                    Checked='<%# (Convert.ToInt32(Eval("Displayed")) == 1) ? true : false%>' CausesValidation="False"></asp:CheckBox>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:CheckBox ID="chkDisplayed" runat="server" Enabled="true"
                                    Checked='<%# (Convert.ToInt32(Eval("Displayed")) == 1) ? true : false%>' CausesValidation="False"></asp:CheckBox>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:CheckBox ID="chkDisplayed" runat="server" CausesValidation="False" />
                            </FooterTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <FooterStyle HorizontalAlign="Center" />
                        </asp:TemplateField>

                        <asp:BoundField DataField="DateCreated" HeaderText="Date Created" HeaderStyle-Width="120px" ReadOnly="true"/>
                        <asp:BoundField DataField="UserCreated" HeaderText="User Created" HeaderStyle-Width="85px" ReadOnly="true" />
                        <asp:BoundField DataField="DateModified" HeaderText="Date Modified" HeaderStyle-Width="120px" ReadOnly="true"/>
                        <asp:BoundField DataField="UserModified" HeaderText="User Modified" HeaderStyle-Width="85px" ReadOnly="true" />
                    </Columns>
                    <PagerStyle HorizontalAlign="Right" Wrap="False" />
                </asp:GridView>
            </td>
        </tr>
    </table>

    </ContentTemplate>
    </asp:UpdatePanel>

    <asp:UpdateProgress ID="LanguageUpdateProgress" runat="server" AssociatedUpdatePanelID="LanguageUpdatePanel">
    <ProgressTemplate>
        <div class="modalpopup">
            <div class="loadingpopup">
                <div class="center">
                    <img src="<%=ResolveUrl("~/Content/Images/Shared/spinner.gif") %>" alt="" height="50" width="50" />
                </div>
                <div class="center">
                     Please wait...
                </div>
            </div>
        </div>
    </ProgressTemplate>
    </asp:UpdateProgress>

</asp:Content>
